package com.iussoft.receiveData.kafka;

import com.alibaba.fastjson.JSONObject;
import com.iussoft.tools.LoggerUtil;
import org.springframework.kafka.support.SendResult;
import org.springframework.util.concurrent.SuccessCallback;

/**
 * @description: 发送成功业务逻辑
 * @author: Hou Dayu
 * @date: Created in 2020/3/1
 */
public class KafkaMsgSuccess implements SuccessCallback<SendResult<String, Object>> {

    @Override
    public void onSuccess(SendResult<String, Object> stringObjectSendResult) {
        JSONObject data = new JSONObject();
        data.put("producerRecord",stringObjectSendResult.getProducerRecord().toString());
        data.put("recordMetadata",stringObjectSendResult.getRecordMetadata().toString());
        LoggerUtil.info("kafka消息发送成功", data.toString());
    }
}
